package com.bw.module_patrol.adapter

import android.graphics.Color
import android.widget.TextView
import com.bw.module_patrol.R
import com.bw.module_patrol.entity.PatrolEntity
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
/**
 * 工单-智慧园区-巡逻管理
 */
class PatrolAdapter:BaseQuickAdapter<PatrolEntity,BaseViewHolder>(R.layout.item_patrol) {
    override fun convert(holder: BaseViewHolder, item: PatrolEntity) {
        holder.setText(R.id.patrol_name,item.patrolPerson)
        holder.setText(R.id.patrol_time,item.patrolTime)
        val status = holder.getView<TextView>(R.id.patrol_status)
        if (item.patrolStatus=="0"){
            status.text ="待开始"
            status.setBackgroundColor(Color.parseColor("#FEF9C3"))
            status.setTextColor(Color.parseColor("#CA8A04"))
        }
        if (item.patrolStatus=="1"){
            status.text ="进行中"
            status.setBackgroundColor(Color.parseColor("#DCFCE7"))
            status.setTextColor(Color.parseColor("#16A34A"))
        }
        if (item.patrolStatus=="2"){
            status.text ="已完成"
            status.setBackgroundColor(Color.parseColor("#F3F4F6"))
            status.setTextColor(Color.parseColor("#4B5563"))
        }
    }
}